﻿using System;
using Shanfree.SharpMovie.BLL;
using Shanfree.SharpMovie.Model;
using System.Collections.Generic;

public partial class Movie_Browse : BasePage
{
    /// <summary>
    /// 影片主键
    /// </summary>
    protected string MovieID
    {
        get
        {
            return GetViewState("MovieID");
        }
        set
        {
            ViewState["MovieID"] = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.MovieID = GetRequest("id");
            ShowInfo(this.MovieID);
        }
    }

    private void ShowInfo(string ID)
    {
        if (string.IsNullOrEmpty(ID))
        {
            return;
        }
        Movie bll = new Movie();
        MovieInfo model = bll.GetByID(ID);
        this.lbIMDB_ID.Text = model.IMDB_ID;
        this.lbOriginalName.Text = model.OriginalName;
        this.Title = model.OriginalName;
        this.lbEnglishName.Text = model.EnglishName;
        this.lbChineseName.Text = model.ChineseName;
        this.lbHongkongName.Text = model.HongkongName;
        this.iPostLink.ImageUrl = model.PostLink;
        this.lbProduceYear.Text = model.ProduceYear;
        this.lbDirector.Text = model.Director;
        this.lbLeadingRule.Text = model.LeadingRule;
        this.lbIntroduce.Text = model.Introduce;
        this.lbAwards.Text = model.Awards;
        this.lbUserID.Text = model.UserID.ToString();
        IList<NationInfo> nList = new Nation().GetList();
        cblNation.DataSource = nList;
        cblNation.DataBind();
    }

    //private void BindURIList()
    //{
    //    IList<DownloadLinkInfo> list = new DownloadLink().GetList(20, 0);
    //    AdminUserInfo aInfo = new AdminUserInfo();
    //    aInfo.Time = DateTime.Now;
    //    list.Add(aInfo);
    //    gvUserList.DataSource = list;
    //    gvUserList.DataBind();
    //}

    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string url = string.Format("Add.aspx?id={0}", this.MovieID);
        Response.Redirect(url, false);
    }
    protected void btnAddList_Click(object sender, EventArgs e)
    {
        string url = string.Format("../List/Mine.aspx?movieid={0}", this.MovieID);
        Response.Redirect(url, false);
    }
}
